﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Customer>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Edit Customer
</asp:Content>

<asp:Content ID="javascript" ContentPlaceHolderID="Javascript" runat="server">
    
    <script type="text/javascript">
        $(document).ready(function() {
        //alert("Start");
            $("#CategoryId").change(function() {
                //alert("change");
                var catDrillDownsUrl = '<%= Url.Action("CategoryDrillDowns", "Enquiry", new {typeID = 1, id = 999}) %>';
                var url = catDrillDownsUrl.replace("999", $(this).val());
                //alert(url);
                $("#product").show();
                $("#product").load(url, productDrillDownLoaded);
            });
        });

        var productDrillDownLoaded = function() {
            //alert("DrillDownLoaded");
            //alert($("#DrillDown1").length);
            if ($("#DrillDown1").length == 1) {
                $("#type").show();
                $("#typeId").focus();
            }
            //else {
            //    $("#DropDownId").focus();
             //   $("#DropDownId").change(function() {
                    //alert("DrillDownChanges");
             //       var prodDrillDownUrl = '<%= Url.Action("ChildDrillDowns", "Enquiry", new {id = 999}) %>';
             //       var url = prodDrillDownUrl.replace("999", $(this).val());
                    //alert(url);
             //       $("#product").show();
             //       $("#product").load(url, productDrillDownLoaded);
             //   });
            //}
        }        ;

        
    </script>
</asp:Content>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="ContentHeader" runat="server">
Edit : <%= Html.DisplayTextFor(m => m.FirstName)%> <%= Html.DisplayTextFor(m => m.LastName)%>
</asp:Content>  

<asp:Content ID="ContentSubNav" ContentPlaceHolderID="ContentSubNav" runat="server">
    
    <li class="selected"><%= Html.ActionLink("Contacts", "Index", "Customers")%></li>
    <li class=""><%= Html.ActionLink("Create Contact", "Create", "Customers")%></li>
    
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%--<% Html.EnableClientValidation(); %>--%>

    <%= Html.ValidationSummary(true, "There were some errors with your form. Please correct and try again") %>
    
    <% using (Html.BeginForm("Edit", "Customers", FormMethod.Post, new {id = "EnquiryForm",  @class = "faux_form" })){%> 
    
    
  
  
            <%--USER INFO--%>
            <div class="formRegion"> 
                <div>
                    <%= Html.LabelFor(m => m.FirstName)%>
                    <%= Html.TextBoxFor(m => m.FirstName, new {@class = "text"}) %>
                    <%= Html.ValidationMessageFor(m => m.FirstName) %>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.LastName)%>
                    <%= Html.TextBoxFor(m => m.LastName, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.LastName)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.AddressLine1)%>
                    <%= Html.TextBoxFor(m => m.AddressLine1, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.AddressLine1)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.AddressLine2)%>
                    <%= Html.TextBoxFor(m => m.AddressLine2, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.AddressLine2)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.Town)%>
                    <%= Html.TextBoxFor(m => m.Town, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.Town)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.County)%>
                    <%= Html.TextBoxFor(m => m.County, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.County)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.PostCode)%>
                    <%= Html.TextBoxFor(m => m.PostCode, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.PostCode)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.Country)%>
                    <%= Html.TextBoxFor(m => m.Country, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.Country)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.LastContactDate)%>
                    <%= Html.TextBoxFor(m => m.LastContactDate, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.LastContactDate)%>
                </div>
                <div>
               <div>
                <%--SOURCES--%>
                    
                </div>
                <div>
                    <%--METHOD--%>
                    <%= Html.LabelFor(m => m.Method)%>
                    <%= Html.TextBoxFor(m => m.Method, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.Method)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.Email)%>
                    <%= Html.TextBoxFor(m => m.Email, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.Email)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.PhoneMobile)%>
                    <%= Html.TextBoxFor(m => m.PhoneMobile, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.PhoneMobile)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.PhoneLandline)%>
                    <%= Html.TextBoxFor(m => m.PhoneLandline, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.PhoneLandline)%>
                </div>
                <div>
                    <%= Html.LabelFor(m => m.DateOfBirth)%>
                    <%= Html.TextBoxFor(m => m.DateOfBirth, new { @class = "text" })%>
                    <%= Html.ValidationMessageFor(m => m.DateOfBirth)%>
                </div>
                
                
                <div>
                    <%--SampleRequest--%>
                    <%= Html.LabelFor(m => m.SampleRequest)%>
                     <%= Html.DropDownListFor(m => m.SampleRequest, new[]{
                        new SelectListItem{Text = "No", Value = "false"},
                        new SelectListItem{Text = "Yes",Value = "true"}
                    }, null, new { @class = "text required" }  
                     ) %>
                    <%= Html.ValidationMessageFor(m => m.SampleRequest)%>
                </div>
                
                    
                
                <div>
                    <%--SampleSent--%>
                    <%= Html.LabelFor(m => m.SampleSent)%>
                     <%= Html.DropDownListFor(m => m.SampleSent, new[]{
                        new SelectListItem{Text = "No", Value = "false"},
                        new SelectListItem{Text = "Yes",Value = "true"}
                    }, null, new { @class = "text required" }  
                     ) %>
                    <%= Html.ValidationMessageFor(m => m.SampleSent)%>
                </div>
                
                
            <div>
            <input type="submit" class="submit" value="ENTER" />
            </div>
            <% } %>

</asp:Content>
